

'''
    1.准备测试数据

    2.执行测试

    3.对比期望结果和实际结果

    传统测试的缺点：
        1.用例管理比较混乱

        2.测试结果需要用肉眼观看，但凡用例太多，结果特别

    unittest对象
        1. 用例管理
        2.结果可以集中用界面报告进行展示
    1. 导入unittest的TestCase类（有资格进行单元测试）
    2. 开发用例
        用例就是一个一个的方法，但是方法必须是testXxxx
'''

from Calc import Calc
from unittest import TestCase

class TestCalc(TestCase):

    def testAdd1(self):
        a = 5
        b = 6
        c = 11

        ca = Calc()
        s = ca.add(a,b)

        self.assertEqual(s,c)

    def testAdd2(self):
        a = -5
        b = -6
        c = -11

        ca = Calc()
        s = ca.add(a,b)

        self.assertEqual(s,c)

    def testAdd3(self):
        a = 6
        b = -6
        c = 0

        ca = Calc()
        s = ca.add(a,b)

        self.assertEqual(s,c)

    def testAdd4(self):
        a = 1000000000000000000000000000000000000000000000000000
        b = 6
        c = 1000000000000000000000000000000000000000000000000006

        ca = Calc()
        s = ca.add(a,b)

        self.assertEqual(s,c)

    def testAdd5(self):
        a = -99999999999999999999999999999999999999999999999999
        b = -1
        c = -100000000000000000000000000000000000000000000000000

        ca = Calc()
        s = ca.add(a, b)

        self.assertEqual(s, c)

    def testMinus1(self):
        a = 6
        b = 5
        c = 1

        ca = Calc()
        s = ca.minus(a, b)

        self.assertEqual(s, c)

    def testMinus2(self):
        a = -6
        b = 6
        c = -12

        ca = Calc()
        s = ca.minus(a, b)

        self.assertEqual(s, c)

    def testMinus3(self):
        a = -6
        b = -5
        c = -1

        ca = Calc()
        s = ca.minus(a, b)

        self.assertEqual(s, c)

    def testMinus4(self):
        a = 100000000000000000000000000000000000000000000000000
        b = 5
        c = 99999999999999999999999999999999999999999999999995

        ca = Calc()
        s = ca.minus(a, b)

        self.assertEqual(s, c)

    def testMinus5(self):
        a = -99999999999999999999999999999999999999999999999999
        b = -1
        c = -99999999999999999999999999999999999999999999999998

        ca = Calc()
        s = ca.minus(a, b)

        self.assertEqual(s, c)

    def testMulti1(self):
        a = 6
        b = 5
        c = 30

        ca = Calc()
        s = ca.multi(a, b)

        self.assertEqual(s, c)

    def testMulti2(self):
        a = -6
        b = 6
        c = -36

        ca = Calc()
        s = ca.multi(a, b)

        self.assertEqual(s, c)

    def testMulti3(self):
        a = -6
        b = -5
        c = 30

        ca = Calc()
        s = ca.multi(a, b)

        self.assertEqual(s, c)

    def testMulti4(self):
        a = 6
        b = 0
        c = 0

        ca = Calc()
        s = ca.multi(a, b)

        self.assertEqual(s, c)

    def testMulti5(self):
        a = -6
        b = 0
        c = 0

        ca = Calc()
        s = ca.multi(a, b)

        self.assertEqual(s, c)

    def testMulti6(self):
        a = 999999999999999999999999999999999999999999999999999999999999999999999999
        b = 999999999999999999999999999999999999999999999999999999999999999999999999
        c = 999999999999999999999999999999999999999999999999999999999999999999999998000000000000000000000000000000000000000000000000000000000000000000000001

        ca = Calc()
        s = ca.multi(a, b)

        self.assertEqual(s, c)

    def testMulti7(self):
        a = 0.0000000000000000000000000000000000000000000000000000000000001
        b = 0.0000000000000000000000000000000000000000000000000000000000001
        c = 1e-122

        ca = Calc()
        s = ca.multi(a, b)

        self.assertEqual(s, c)

    def testDevision1(self):
        a = 6
        b = 5
        c = 1.2

        ca = Calc()
        s = ca.devision(a,b)

        self.assertEqual(s,c)

    def testDevision2(self):
        a = -6
        b = 6
        c = -1

        ca = Calc()
        s = ca.devision(a,b)

        self.assertEqual(s,c)

    def testDevision3(self):
        a = -6
        b = -5
        c = 1.2

        ca = Calc()
        s = ca.devision(a,b)

        self.assertEqual(s,c)

    def testDevision4(self):
        a = 0
        b = 5
        c = 0

        ca = Calc()
        s = ca.devision(a,b)

        self.assertEqual(s,c)

    def testDevision5(self):
        a = 0
        b = 6
        c = 0

        ca = Calc()
        s = ca.devision(a,b)

        self.assertEqual(s,c)

    def testDevision6(self):
        a = 999999999999999999999999999999999999999999999999999999999999999999999999
        b = 999999999999999999999999999999999999999999999999999999999999999999999999
        c = 1

        ca = Calc()
        s = ca.devision(a,b)

        self.assertEqual(s,c)

    def testDevision7(self):
        a = 0.0000000000000000000000000000000000000000000000000000000000000000000001
        b = 0.0000000000000000000000000000000000000000000000000000000000000000000001
        c = 1

        ca = Calc()
        s = ca.devision(a,b)

        self.assertEqual(s,c)

    def testDevision8(self):
        a = 999999999999999999999999999999999999999999999999999999999999999999999999
        b = 0.0000000000000000000000000000000000000000000000000000000000000000000001
        c = 9.999999999999999e+141

        ca = Calc()
        s = ca.devision(a,b)

        self.assertEqual(s,c)

    def testDevision9(self):
        a = 0.0000000000000000000000000000000000000000000000000000000000000000000001
        b = 999999999999999999999999999999999999999999999999999999999999999999999999
        c = 1e-142

        ca = Calc()
        s = ca.devision(a,b)

        self.assertEqual(s,c)



